﻿using HslCommunication;
using HslCommunication.MQTT;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace XMFramework.HSLGateway
{
    public class hslGateway
    {
        public static MqttSyncClient mqtt = new MqttSyncClient(new MqttConnectionOptions()
        {
            IpAddress = "127.0.0.1",
            Port = 521,
            Credentials = new MqttCredential()
            {
                UserName = "admin",
                Password = "123456"
            },
            ConnectTimeout = 2000
        });

        public void readGData()
        {
            OperateResult<float> read = mqtt.ReadRpc<float>("Edge/DeviceData", new { data = "/SPZ/D1/D2000" });
            if (read.IsSuccess)
                Console.WriteLine(read.Content.ToString());
        }
    }
}
